package com.mall.inventory.server.controller;

import com.mall.common.core.domain.Result;
import com.mall.inventory.common.dto.CmsPurchaseOrderDto;
import com.mall.inventory.common.dto.CmsPurchasePlanDto;
import com.mall.inventory.common.po.CmsPurchasePlan;
import com.mall.inventory.server.service.InventoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/inventory")
public class InventoryController {

    @Autowired
    private InventoryService inventoryService;

    /**
     * 添加采购计划
     * @param skuIds
     * @return
     */
    @PostMapping("/addCmsPurchasePlan")
    public Result addCmsPurchasePlan(String skuIds){
        return Result.success(inventoryService.addCmsPurchasePlan(skuIds));
    }

    /**
     * 添加采购订单
     * @param cmsPurchaseOrderDto
     * @return
     */
    @PostMapping("/addPurchaseOrder")
    public Result addPurchaseOrder(@RequestBody  CmsPurchaseOrderDto cmsPurchaseOrderDto){
        return Result.success(inventoryService.addPurchaseOrder(cmsPurchaseOrderDto));
    }

    /**
     * 查询采购需求列表
     * @param cmsPurchasePlanDto
     * @return
     */
    @GetMapping("/CmsPurchasePlanList")
    public Result CmsPurchasePlanList(CmsPurchasePlanDto cmsPurchasePlanDto){

        return inventoryService.CmsPurchasePlanList(cmsPurchasePlanDto);
    }

}
